package com.chem.lems.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "lems_record")
public class Record {

    @Id
    @Column(name = "record_id", length = 50)
    @GenericGenerator(name = "jpa-uuid", strategy = "uuid")
    @GeneratedValue(generator="jpa-uuid")
    @ExcelProperty("记录流水")
    @ColumnWidth(35)
    private String recordId;

    //用户ID
    @ExcelProperty("借取人ID")
    @Column(name = "user_id", length = 50)
    @ColumnWidth(35)
    private String userId;

    //借取人
    @ExcelProperty("借取人")
    @Column(name = "user_name", length = 50)
    @ColumnWidth(12)
    private String userName;


    // 设备ID
    @ExcelProperty("设备ID")
    @Column(name = "equip_id", length = 50)
    @ColumnWidth(35)
    private String equipId;

    // 设备名称
    @ExcelProperty("设备名称")
    @ColumnWidth(20)
    @Column(name = "equip_name", length = 50)
    private String equipName;
    /**
     * 创建时间
     */
    @CreatedDate
    @ExcelProperty("借取时间")
    @ColumnWidth(18)
    @Column(name = "apply_time", length = 50,updatable = false, nullable = false)
    private Date applyTime;

    /**
     * 归还时间
     */
    @ExcelProperty("归还时间")
    @Column(name = "back_time")
    @ColumnWidth(18)
    private Date backTime;

}
